Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

602
Vistas
Mailu with docker on a Raspberry Pi running a "native" nginx web server

I configured Nextcloud on a Raspberry Pi 4 running Ubuntu Server 18.04.4 64-bit, following Carsten Rieger guide so now on the Pi is installed and running nginx. Then, using Mailu configuration I installed a mail server with Docker Compose. I chenged standard configuration because conflicting ports 80 and 443 used by "native" nginx and "docker container" nginx, so in container I use 8080 and 8443.

How must I configure native nginx so when I visit my mail.mydomain.com redirect to 8080 and 8443 ports? How can obtains certificates for HTTPS for mail.mydomain.com with Let's Encrypt?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If I understand your problem correct, you like to use the nginx on the host as a proxy server to redirect traffic to the docker container.

Extend your nginx.conf on the host:

http {

...


  # redirect http to https from your domain
  server {
      listen 80;
      server_name localhost, <your domain>, <secondary domain>;
      return 301 https://<your domain>$request_uri;
  }

  # simple reverse-proxy
  server {
    listen 443;
    server_name  localhost, <your domain>, <secondary domain>;

    ssl on;
    # if you use let's encrypt (certbot) /etc/letsencrypt/live/<your domain>/fullchain.pem
    ssl_certificate      <path to certificate>;
    # if you use let's encrypt (certbot) /etc/letsencrypt/live/<your domain>/privkey.pem
    ssl_certificate_key  <path to key>;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE

    client_max_body_size 200M;

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
      proxy_pass      http://localhost:8080;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Host $http_host;

      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forward-Proto http;
      proxy_set_header X-Nginx-Proxy true;

      proxy_redirect off;
    }
  }

... 

}

To Your second question, yes you can use Let's Encrypt to obtain the certificate. Either as standalone or with the nginx plugin.

$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx

Obtain your certificate without nginx plugin (you need to stop the nginx first because certbot uses the port 80)

$ sudo certbot certonly --standalone -d <your domain> -d <secondary domain>

Obtain your certificate with the nginx plugin

$ sudo certbot --nginx -d <your domain> -d <secondary domain>

In any case you need to reload the nginx after a certificate was retrieved or renewed:

$ sudo service nginx reload 
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda